#!/usr/bin/env python3
import os
import sys
import subprocess

def main():
    print("🚀 启动来访接待智能PPT生成器...")
    print("📁 检查依赖...")
    
    # 检查并安装依赖
    try:
        import flask
        import flask_cors
        import pptx
        print("✅ 依赖已安装")
    except ImportError:
        print("📦 安装依赖...")
        subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
    
    # 启动后端服务
    print("🌐 启动Flask服务...")
    print("📱 请访问: http://localhost:5000")
    print("🛑 按 Ctrl+C 停止服务")
    
    os.chdir('backend')
    subprocess.call([sys.executable, "app.py"])

if __name__ == "__main__":
    main()
